<!DOCTYPE html>
<html>

<head>
    <title> {% block title %} Django CQRS demo{% endblock %}</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
          integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
</head>

<body>
<!-- Navigation -->
<header class="p-3 mb-4 bg-dark text-white">
    <div class="container d-flex flex-wrap">
        <a href="/" class="d-flex align-items-center col-md-3 mb-2 mb-md-0 text-light text-decoration-none">
            Django CQRS demo
        </a>

        <ul class="nav me-auto">
            <li><a href="{% url "blogs:home" %}" class="nav-link text-white">Home</a></li>
            {% if user.is_authenticated %}
                <li><a href="{% url "blogs:posts_my" %}" class="nav-link text-white">My posts</a></li>
                <li><a href="{% url "blogs:post_create" %}" class="nav-link text-white">New post</a></li>
            {% endif %}
        </ul>
        <ul class="nav">
            {% if user.is_authenticated %}
                <li><a class="nav-link text-light font-weight-bold" href="#">{{ user }}</a></li>
                <li>
                    <form method="POST" action="{% url "users:logout" %}">
                        {% csrf_token %}
                        <button type="submit" class="btn btn-primary">Logout</button>
                    </form>
                </li>
            {% else %}
                <li><a class="btn btn-outline-light me-2" href="{% url "users:register" %}">Register</a></li>
                <li><a class="btn btn-warning" href="{% url "users:login" %}">Login</a></li>
            {% endif %}
        </ul>
    </div>
</header>

<div class="container">
    {% block content %}
        <!-- Content Goes here -->
    {% endblock content %}
</div>

<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"
        integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB"
        crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js"
        integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13"
        crossorigin="anonymous"></script>
</body>
</html>